$(document).ajaxSend(function (e, xhr, opt) {
    var user_token = localStorage.getItem("user_token");
    xhr.setRequestHeader("user_token_header", user_token);
});


function getUserInfo(url) {
    $.ajax({
        type:"get",
        url:url,
        success:function(result) {
            console.log(result);
            if(result.code == 200 && result.data != null) {
                //填写用户主页信息
                $(".left .card h3").text(result.data.userName);
                $(".left .card a").attr("href",result.data.githubUrl);
            } else {
                //
            }
        }

    })
}

function logout() {
    //删除Cookie，设置Cookie为空 
    localStorage.removeItem("user_token");
    location.href = "blog_login.html";
}